package test;

import java.util.concurrent.atomic.AtomicBoolean;

public class test2Thread implements Runnable {

	protected final  AtomicBoolean wakenUp = new AtomicBoolean();
	boolean d=true;
	
	public test2Thread(int f) {
		k=f;
	}

	private int k = 1;

	public int getK() {
		return k;
	}

	public synchronized void setK(int k) {
		this.k = k;
	}

	@Override
	public synchronized void run() {

		
			while (d) {
				wakenUp.set(false);
				while (!wakenUp.get()) {
//					try {
//						wait(50);
//					} catch (InterruptedException e) {
//						// TODO Auto-generated catch block
//						e.printStackTrace();
//					}
					System.out.println(2);
					
				}
				System.out.println(1);
				d=false;
			}
		

	}

}
